//
//  Car_ContrastConsequenceHeaderTableViewCell.m
//  CarUser
//
//  Created by ayi on 2019/1/23.
//  Copyright © 2019 王森林. All rights reserved.
//

#import "Car_ContrastConsequenceHeaderTableViewCell.h"

@implementation Car_ContrastConsequenceHeaderTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

+ (Car_ContrastConsequenceHeaderTableViewCell *)initCellWithReuseIdentifier:(NSString *)reuseIdentifier andTab:(UITableView *)tab{
    Car_ContrastConsequenceHeaderTableViewCell *cell = [tab dequeueReusableCellWithIdentifier:reuseIdentifier];
    if (!cell) {
        cell = [[Car_ContrastConsequenceHeaderTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
    }
    return cell;
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        _lab1 = [UILabel customInitLabWithFont:14 andTextColor:Common_TextColor andAlign:NSTextAlignmentLeft];
        _lab1.numberOfLines = 3;
        _lab2 = [UILabel customInitLabWithFont:14 andTextColor:Common_TextColor andAlign:NSTextAlignmentLeft];
        _lab2.numberOfLines = 3;
        _moneyLab1 = [UILabel customInitLabWithFont:14 andTextColor:Common_TextColor andAlign:NSTextAlignmentLeft];
        _moneyLab2 = [UILabel customInitLabWithFont:14 andTextColor:Common_TextColor andAlign:NSTextAlignmentLeft];
        _hiddenBtn = ({
            UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
            btn.frame = CGRectMake(0, 0, BOUNDWIDTH * 1.5, 70);
            btn.titleLabel.font = FONT_SIZE(14);
            [btn setTitle:@"隐藏相同" forState:UIControlStateNormal];
            [btn setTitle:@"显示相同" forState:UIControlStateSelected];
            [btn setImage:IMG(@"hidden1") forState:UIControlStateNormal];
            [btn setImage:IMG(@"hidden2") forState:UIControlStateSelected];
            [btn setTitleColor:Common_BG_yellow forState:UIControlStateNormal];
            [btn setTitleColor:Common_BG_yellow forState:UIControlStateSelected];
            [btn setTitleColor:Common_BG_yellow forState:UIControlStateHighlighted];
            btn.backgroundColor = Common_NavigroundColor;
            btn;
        });
        [_hiddenBtn btnTitleUnderImgWithHeight:30];
        UIView *line = [[UIView alloc]init];line.backgroundColor = Common_SepeColor;
        
        
        [self.contentView addSubview:_lab1];
        [self.contentView addSubview:_lab2];
        [self.contentView addSubview:_moneyLab1];
        [self.contentView addSubview:_moneyLab2];
        [self.contentView addSubview:_hiddenBtn];
        [self.contentView addSubview:line];
        
        [_hiddenBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            (void)make.top.and.left.and.bottom;
            make.width.mas_equalTo(BOUNDWIDTH * 1/5);
        }];
        [_lab1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(10);
            make.left.equalTo(self.hiddenBtn.mas_right).offset(10);
            make.width.mas_equalTo(BOUNDWIDTH * 2/5 - 20);
        }];
        [_moneyLab1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.mas_equalTo(-10);
            make.left.equalTo(self.lab1.mas_left);
            make.right.equalTo(self.lab1.mas_right);
            make.height.mas_equalTo(ceilf(self.moneyLab1.font.lineHeight));
        }];
        
        [_lab2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(10);
            make.left.equalTo(self.lab1.mas_right).offset(20);
            make.right.mas_equalTo(-10);
        }];
        [_moneyLab2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.mas_equalTo(-10);
            make.left.equalTo(self.lab2.mas_left);
            make.right.equalTo(self.lab2.mas_right);
            make.height.mas_equalTo(ceilf(self.moneyLab2.font.lineHeight));
        }];
        
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            (void)make.top.and.bottom;
            make.width.mas_equalTo(.5f);
            make.right.mas_equalTo(-BOUNDWIDTH * 2/5);
        }];
    }
    return self;
}

@end
